const xss = require('xss');
const source = `<div a="1" b="2" data-a="3" data-b="4">hello</div>`;
const html = xss(source, {
    onIgnoreTagAttr(tag, name, value, isWhiteAttr) {
        if (name.substring(0, 5) === 'data-') {
            return name + '="' + xss.escapeAttrValue(value) + '"';
        }
    }
})

console.log(html);
